<template>
  <div class="home">
    <HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted } from "vue";
import HelloWorld from "@/components/HelloWorld.vue"; // @ is an alias to /src
import actions from "../share/action";
export default defineComponent({
  name: "Home",
  components: {
    HelloWorld,
  },
  setup(props, ctx) {
    onMounted(() => {
      actions.onGlobalStateChange((state: any) => {
        const { userId } = state;
        // 未登录 - 返回主页
        if (!userId) {
          console.error("未检测到登录信息！");
        }
        console.log("userId", userId);
      }, true);
    });
  },
});
</script>
